/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: DoubleInnerSomeColumn
 * @Package com.rx.core.dbase.mutil
 * @Description: 双表内联
 * @author: 陈锦韬
 * @date: 2021\7\22 0022
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.core.dbase.mutil.method;

import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.core.injector.methods.SelectList;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import lombok.NoArgsConstructor;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;

/**
 * @author: Administrator
 * @Description: 双表内联
 * @date: 2021\7\22 0022
 */
@NoArgsConstructor
//@AllArgsConstructor
@SuppressWarnings("serial")
public class DoubleInnerSomeColumn extends SelectList {
    @Override
    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
        String sql = String.format("<script>\nSELECT %s FROM %s \n</script>", sqlSelectColumns(tableInfo, false),
                tableInfo.getTableName());
        SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);
        return this.addSelectMappedStatement(mapperClass, "innerSearchList", sqlSource, modelClass, tableInfo);
    }
}
